const { View , Text , Button} = require("@tarojs/components");
import './LookReport.less'
import http from '../../../../utils/http'
import Taro,{useReady} from '@tarojs/taro'
import React, { useState} from 'react'

const look=(b)=>{
    Taro.navigateTo({
        url:'/pages/HXM/AllReport/AllReport?id='+b
    })
}

const cancel=(b) =>{
	console.log(b);
}

const go=(b) =>{
	console.log(b);  
}

function LookReport(){
	const [index,setIndex]=useState('')
    const [sum,setSum]=useState()
    const [id,setId]=useState('')
    const [arr,setArr]=useState([])

	useReady(() => {
		setId(Taro.getCurrentInstance().router.params.id)
        http({   //获取我的体检详细
            url:"/getlookreport",
            data:{
                order_orderId:Taro.getCurrentInstance().router.params.id
            },
            header:{
                'content-type': 'application/json' 
            },
        }).then((res)=>{
            setArr(res[0])
        })
      })

    return(
        <view>
		<view class="view1">
			<view>健康指数</view>
			<view>
			{parseInt((arr.SBP+arr.SBP+arr.BP+arr.health+arr.hemameba+arr.red_blood+arr.hemoglobin+arr.HCT+arr.ALT+arr.AST+arr.GGT+arr.pulse+arr.indexa)/(arr.stature)*5)}
			</view>
			<button type="primary" plain="true" onClick={look.bind(this,id)}>查看全部项目</button>
			<view class="">
				您的健康指数为
				{parseInt((arr.SBP+arr.SBP+arr.BP+arr.health+arr.hemameba+arr.red_blood+arr.hemoglobin+arr.HCT+arr.ALT+arr.AST+arr.GGT+arr.pulse+arr.indexa)/(arr.stature)*5)}
				分，比
				{parseInt((arr.SBP+arr.SBP+arr.BP+arr.health+arr.hemameba+arr.red_blood+arr.hemoglobin+arr.HCT+arr.ALT+arr.AST+arr.GGT+arr.pulse+arr.indexa)/(arr.stature)*4)}
				%的人更健康
			</view>
		</view>
		<view class="view2">
			<view><text>历史对比</text></view>
			<view>
				<text>身高</text>
				<text>{arr.stature}cm</text>
			</view>
			<view>
				<text>体重指数BMI</text>
				<text>{arr.weight/10}</text>
			</view>
			<view>
				<text>收缩压</text>
				<text>{arr.SBP}mmHg</text>
			</view>
			<view>
				<text>舒张压</text>
				<text>{arr.DBP}mmHg</text>
			</view>
			<view>
				<text>血小板</text>
				<text>{arr.BP}*10^9/L</text>
			</view>
		</view>
		<view class="view3">
			<view>异常指数</view>
			<view>
				<text>血小板</text>
				<text>{arr.BP==400?arr.BP:'无'}</text>
			</view>
		</view>
		<view class="view4">
			<view>综述</view>
			
			<view class="view4-1">
				<view>综检结论</view>
				<view>
					1、{arr.opinionFirst}
				</view>
				<view>
					2、{arr.opinionSecond}
				</view>
			</view>
			<view class="view4-1">
				<view>医疗保健</view>
				<view>
					{arr.conclusion}
				</view>
			</view>
		</view>
		<view class="view5">
			<button type="primary" plain="true" onClick={cancel(id)}>咨询医生</button>
			<button type="primary" plain="true" onClick={go(id)}>快速挂号</button>
		</view>
	</view>
    )
}
export default LookReport